﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;

/// <summary>
/// Summary description for ConexaoROBOT
/// </summary>
public class ConexaoROBOT
{
	public ConexaoROBOT()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public OracleConnection connROBOT()
    {
        String Ambiente = "ROBOT_" + HttpContext.Current.Session["ses_ambiente"];
        
        OracleConnection connROBOT = new OracleConnection();
        //connROBOT.ConnectionString = ConfigurationManager.ConnectionStrings["ROBOT"].ConnectionString;
        connROBOT.ConnectionString = ConfigurationManager.ConnectionStrings["" + Ambiente + ""].ConnectionString;
        connROBOT.Open();

        return connROBOT;
    }

    public OracleCommand cmdROBOT(String cmd)
    {
        OracleCommand cmdROBOT = new OracleCommand();
        cmdROBOT.CommandType = System.Data.CommandType.StoredProcedure;
        cmdROBOT.CommandText = cmd;
        cmdROBOT.Connection = connROBOT();

        return cmdROBOT;
    }
}
